import java.time.LocalDateTime;

public abstract class User {
    private String userId;
    private String username;
    private String password;
    private LocalDateTime registerTime;
    private UserType userType;
    private String phone;

    public User(String userId, String username, String password, UserType userType, String phone) {
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.registerTime = LocalDateTime.now();
        this.userType = userType;
        this.phone = phone;
    }

    public abstract void showMenu();

    public boolean changePassword(String oldPwd, String newPwd) {
        if (this.password.equals(oldPwd)) {
            this.password = newPwd;
            return true;
        }
        return false;
    }

    public String getUserId() { return userId; }
    public String getUsername() { return username; }
    public String getPassword() { return password; }
    public LocalDateTime getRegisterTime() { return registerTime; }
    public UserType getUserType() { return userType; }
    public String getPhone() { return phone; }
    public void setPassword(String password) { this.password = password; }
}